// components/tabbar/index.ts
Component({

  /**
   * 组件的属性列表
   */
  options: {
    addGlobalClass: true
  },
  properties: {
    active: {
      type: Number,
      default: 0
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    list: [{
        title: '首页',
        icon: 'home-o',
        url: ''
      },
      {
        title: '分类',
        icon: 'apps-o',
        url: ''
      },
      {
        title: '卡密激活',
        icon: 'shield-o',
        url: ''
      },
      {
        title: '我的',
        icon: 'user-o',
        url: ''
      }
    ]
  },



  /**
   * 组件的方法列表
   */
  methods: {
    onChange(e) {
      let url = "";
      switch (e.detail) {
        case 0:
          url = "/pages/index/index";
          break;
        case 1:
          url = "/pages/category/index";
          break;
        case 2:
          url = "/pages/cardsercet/index";
          break;
        case 3:
          url = "/pages/centre/index";
          break;
      }
      wx.switchTab({
        url: url,
        success: function (e) {
          var page = getCurrentPages().pop();
          if (page == undefined || page == null) return;
          page.onLoad();
        }
      })
    }
  }
})
